<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Api as API;
use Illuminate\Contracts\Routing\Registrar as Routes;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

/*Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});*/


Route::group(['prefix' => 'auth'], function (Routes $routes) {

    $routes->post('login',API\AuthController::class . "@login");
    $routes->post('logout', API\AuthController::class . "@logout" );//'AuthController@logout');
    $routes->post('refresh', API\AuthController::class . "@refresh");//'AuthController@refresh');

    $routes->group(['middleware' => 'auth:api'], function (Routes $routes){
        //Route::post('login', 'AuthController@login');
        $routes->post('me', API\AuthController::class . "@me");//'AuthController@me');
        $routes->group(['prefix' => 'sms','middleware'=>'BeforeUser'], function (Routes $routes){
            $routes->post('/', App\Http\Controllers\Api\SmsController::class . "@sendSms");
        });
    });

});